package cn.hjh.service.Impl;

import cn.hjh.dao.UsersDao;
import cn.hjh.pojo.Users;
import cn.hjh.service.UsersService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class UsersServiceImpl implements UsersService {

    @Resource
    private UsersDao userDaoImpl;

    @Transactional
    @Override
    public void save(Users users) {
        userDaoImpl.insert(users);
    }

    @Transactional
    @Override
    public Users denglu(String name,String password) {

        Users users=userDaoImpl.denglu(name);

        if (users!=null){
            if(!users.getPassword().equals(password)){
                users=null;
            }
        }

        return users;
    }
}
